package org.sang.bbbig.dao;

import org.apache.ibatis.annotations.*;
import org.sang.bbbig.model.Student;
import org.sang.bbbig.model.User;

import java.util.List;

@Mapper
public interface StudentDao {

    @Insert("INSERT INTO student(id,name,password,classroom,gender) values (#{id},#{name},#{password},#{classroom},#{gender})")
    int addstudent(Student student);

    @Delete("delete from student where id=#{id}")
    int delete(int id);

    @Update("UPDATE student SET id=#{id},name=#{name},password=#{password},classroom=#{classroom},gender=#{gender} WHERE id=#{id} ")
    int update(Student student);

    @Select("select * from student where id=#{id}")
    Student quiery(int id);

    @Select("SELECT * FROM student")
    List<Student> allStudent();

    @Select("SELECT name,password FROM student")
    List<User> nickandpwd();
}
